import Qt 4.7
import "ContextualMenu.js" as CtxMenu

Item {
     id: blokOfScheme
     width: 100
     height:100
     property alias source: blokImage.source
     property alias paramName: parameterText.paramName

     property alias valueParam: inputFs.text

     signal clicked;
     // Строка ввода параметра
     FocusScope {
         z:10
         id : parameterText
         opacity: 0
         width: blokOfScheme.width - 10
         height: 20
         anchors.horizontalCenter: parent.horizontalCenter
         Rectangle{color: "#f09baeff"; anchors.fill: parent }
         signal accepted
         property alias text: inputFs.text
         property alias item: inputFs
         property string paramName: "Fs"
         Text{
             id: nameParam
             font.pixelSize: 16;
             font.bold: true
             color: "black"
             anchors.left: parent.left;
             anchors.leftMargin: 2
             text: parent.paramName + ":"
         }
         TextInput{
             id: inputFs
             width: parent.width - nameParam.width
             anchors.left: nameParam.right
             font.pixelSize: 16;
             font.bold: true
             color: "black"; selectionColor: "mediumseagreen"
             focus: true
             //onAccepted:{ blokOfScheme.paramInputed(text)}
             text: "100"
             selectByMouse: true
         }
     }
    // Сам блок
     Image{
         id: blokImage
         smooth: true
         anchors.horizontalCenter:blokOfScheme.horizontalCenter
         anchors.bottom:blokOfScheme.bottom
         width : 50
         height: 60
         source: "bloks/psp.PNG"
         property int indexBlok: 0;
         Rectangle{
             id : press_mask
             anchors.fill: parent
             opacity : 0
             color: "gray"
         }
         MouseArea {
                     id: blokMouseArea;
                     anchors.fill: parent
                     hoverEnabled : true
                     onEntered : {press_mask.opacity = 0.2}
                     onExited : {press_mask.opacity = 0}
                     onClicked : {
                         if (parent.state !=  "push") parent.state =  "push";
                         else   parent.state =  "";
                         blokOfScheme.clicked();
                         }
         }
         states: [
             State {
             name: "push";
                 PropertyChanges { target: blokImage; scale: 1.1}
                 PropertyChanges { target: parameterText; opacity: 1}
             }
         ]
         transitions: [
             Transition {
             from: ""; to: "push"; reversible: true
                 ParallelAnimation {
                     NumberAnimation { properties: "scale"; duration: 200; easing.type: Easing.InOutQuad }
                     NumberAnimation { properties: "opacity"; duration: 200; easing.type: Easing.InOutQuad }
                 }
             }
         ]

     }
}
